var MongoClient = require('mongodb').MongoClient
var url = "mongodb://localhost:27017/"

// 插入多条数据
MongoClient.connect(url, {useNewUrlParser:true, useUnifiedTopology: true}, function(err, db) {
  if (err) throw err
  var dbo = db.db("user")
  var myobj = [
    {name: "老陈", type: "帅", like: ["说", "唱", "跳"]},
    {name: "A", type: "帅", like: ["说", "跳"]},
    {name: "B", type: "帅", like: ["说", "唱"]},
  ];
  dbo.collection("users").insertMany(myobj, function(err, res) {
    if (err) throw err
    console.log("插入文档数量为：" + res.insertedCount);
    db.close()
  })
})

